
=head1 NAME

rmprivate - small perl script used in conjunction with clearcase perl
to look at and remove private files

=head1 SYNOPSIS

ccperl rmprivate.perl vobname matching_string 0|1

=head1 DESCRIPTION

The matching_string should be put under '' if it contains
characters like *

The last option should be set to 0 to display and 1 to remove the files.

=cut

my $drive = 'y:';
my $vob = $ARGV[0];
my $ext = $ARGV[1];
my $rem = $ARGV[2];

print "$vob $ext $rem\n";

open(FILE,"cleartool lsprivate -invob $vob|");
my @list = <FILE>;
close(FILE);

my @flist = grep { $_ = $drive .  $_; chomp; not m/DIR/g;} @list;
@list = grep { m/$ext/g;} @flist;
if ($rem) {
	@cannot = grep {not unlink} @list;
	die "$0: could not unlink @cannot\n" if @cannot;
}
else {
	foreach (@list) {print $_ . "\n";}
}


